<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import = "jdbc.*" %>
<%@ page import = "java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%@ include file = "login.jsp" %>
<%
String type = request.getParameter("queryType");


//课程接口
//mysql.newClass("3", "java小学期", "3", "许斌", 100, "2014-9-25");
//mysql.chooseClass("gb1@qq.com", "123");
//mysql.delClass("123");
//List<HashMap<String, String>> hm = mysql.searchClassByNumber("1");

JdbcDao mysql = new JdbcDao();
List<HashMap<String, String>> listhm = null;

if (type == null) {
	listhm = mysql.getClassList();
} else if (type.equals("mine")) {
	listhm = mysql.getMyClassList(email_status);
} else if (type.equals("searchByName")) {
	String searchContent = request.getParameter("content");
	listhm = mysql.searchClassByName(searchContent);
} else if (type.equals("searchByNnumber")) {
	String searchContent = request.getParameter("content");
	listhm = mysql.searchClassByNumber(searchContent);
} else {
	listhm = mysql.getClassList();
}
%>

	<form action="classlist.jsp" method="GET">
		<div>Query Type (searchByName/searchByNnumber/mine):<input name = "queryType" type="text"/></div>
		<div>search content :<input name = "content" type="text"/></div>
		<input type="submit" value="Search" />
	</form>
	<br>	
	<br>
	
	<form action="chooseclass.jsp" method="GET">
		<div>email : <input name = "email" type="text"/></div>
		<div>classNumber : <input name = "classNumber" type="text"/></div>
		<input type="submit" value="Choose Class" />
	</form>	
	<br>
	<br>
	
	<form action="deluserclass.jsp" method="GET">
		<div>email : <input name = "email" type="text"/></div>
		<div>classNumber : <input name = "classNumber" type="text"/></div>
		<input type="submit" value="Delete User Class" />
	</form>	
	<br>
	<br>
	
	<form action="delclass.jsp" method="GET">
		<div>classNumber : <input name = "classNumber" type="text"/></div>
		<input type="submit" value="Delete Class" />
	</form>	
	<br>
	<br>
	
	
	
	
<div class="tab" style="width:100%;margin-left:0px;margin-right:0px;" id="table_sy">
        
     
     <table border="0" cellpadding="0" cellspacing="1">
		  <tr class="trr1">
                         <td style="width:5%"><div align="center"><span class="trunk">课程号</span></div></td>
						 <td style="width:8%"><div align="center"><span class="trunk">课程名</span></div></td>
                         <td style="width:4%"><div align="center"><span class="trunk" id="xf_sy">学分</span></div></td>
                         <td style="width:5%"><div align="center"><span class="trunk">主讲教师</span></div></td>
						 <td style="width:5%"><div align="center"><span class="bkskrl">本科生课容量</span></div></td>
                     	 <td style="width:12%"><div align="center" style=""><span class="trunk">上课时间</span></div></td>
			    		 <td style="width:4%"><div align="center"><span class="trunk">已选人数</span></div></td>
		 </tr>
		 
		 <%
		 int len = (listhm.size() < 10) ? listhm.size() : 10;
		 
		 
		 for (int i = 0; i < len; ++i) {		 
		 	HashMap<String, String> classHM = listhm.get(i);
		 
		 %>
			
         <tr class="trr2">
						 <td><div align="center"><span><% out.println(classHM.get("number")); %></span></div></td>
						
                         <td> <!-- style="text-align:left" --><div align="center"><span class="trunk"><% out.println(classHM.get("name")); %></span></div></td>
 					
						 <td><div align="center"><span ><% out.println(classHM.get("credit")); %></span></div></td>
						
						 <td><div align="center"><span class="trunk"><% out.println(classHM.get("teacher")); %></span></div></td>   
 					
						 <td><div align="center"><span ><% out.println(classHM.get("numlimit")); %></span></div></td>
						 <td><div align="center"><span class="trunk"><% out.println(classHM.get("classdate")); %></span></div></td>

					<!-- 	 <td><span class="trunk">实验课</span></td> -->
		    			 <td><div align="center"><span class="trunk"><% out.println(classHM.get("tempnum")); %></span></div></td>
<!-- 		        		 <td><div align="center"><span >否</span></div></td>
		         		 <td><div align="center"><a class='mainHref' href='xk.xk_syrwb.do?m=show&p_xnxq=2013-2014-3&p_kch=00120022&p_kxh=1' target='_blank'><span class="trunk">实验信息</span></a></div></td>
		
		   				 <td><div align="center"><span>否</span></div></td>
		         		 <td><div align="center"><span ></span></div></td>
		         		 <td><span class="trunk"></span></td> -->
		   </tr>
		   <%
		 	}
		   
		   
		   %>
  	</table>
</div>




</body>
</html>